<?php
include("include/config.inc.php");
if(!isset($_SESSION['s_activId']))
{
  header("location:checklogin.php");
}

//Insert Query of Transaction In 
if(isset($_POST['insertBtn']))
{  
  $accountName  = (isset($_POST['accountName'])) && ($_POST['accountName'] != "") ? $_POST['accountName'] : 0 ;
  $insertQuerydriver = "INSERT INTO account (accountName)
                             VALUES('".$accountName."')";
   $insertQuerydriverdResult = mysql_query($insertQuerydriver);
   if(!$insertQuerydriverdResult)
     die("Insert Query Not Inserted : ".mysql_error());
   else
   {
     //header("Location:account.php");
   }
}

//Select Query of Transaction In
$accountArray = array();
$i = 0;
$selectTransaction = "SELECT accountId, accountName
                        FROM account";
$selectTransactionRes  = mysql_query($selectTransaction);
while($transactionInRow = mysql_fetch_array($selectTransactionRes))
{
  $accountArray[$i]['accountId'] = $transactionInRow['accountId'];
  $accountArray[$i]['accountName']   = $transactionInRow['accountName'];
  $i++;
}


include("./bottom.php");
$smarty->assign("accountArray",$accountArray);  
$smarty->display('account.tpl');
?>